<html>
<head>
<?php require_once 'commonJS.php'; ?>
<script>
    $(document).ready(function(){
                   $( "#from" ).datepicker({
                        dateFormat: 'yy-mm-dd',
                        showOn: "button",
			buttonImage: "images/calendar.gif",
			buttonImageOnly: true,
                        changeMonth: true,
                        changeYear: true,
                        yearRange: "-30"
                   });
              });
</script>
<script>
    $(document).ready(function(){
                   $( "#to" ).datepicker({
                        dateFormat: 'yy-mm-dd',
                        showOn: "button",
			buttonImage: "images/calendar.gif",
			buttonImageOnly: true,
                        changeMonth: true,
                        changeYear: true,
                        yearRange: "-30"
                   });
              });
</script>
</head>
<?
if (!defined('MODULE_FILE')){
die ("cant access file directly!");
}
$mid2=$_GET['mid'];//echo $mid2;
?>
<?
$id=$_GET['id'];
require_once 'class/EmpRegister.php';

$att = new EmpRegister();

if(isset($_GET['id'])== true){
    $uID = $_GET['id'];
    $result = $att->get1($uID);
    
}


//$sql=mysql_query("select * from users where id='$id'");
//$row=mysql_fetch_array($sql);
?>
<body>
	<div style="margin-left:20px; margin-top: 10px;">
		<p>
			<a class="btn btn-outline btn-primary btn-xs" id="active" href="modules.php?file=user_list&mid=<? echo $mid;?>&smid=<? echo $smid;?>" >List All Users</a>
		</p>
	</div>

<div class="col-lg-6">
<div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-bell fa-fw"></i>Add User</div>
<div class="panel-body">

<form id="formSubmit" action="modules.php?file=user_ins&uid=<? echo $id; ?>&mid=<? echo $mid2; ?>&smid=<? echo $smid; ?>" method="POST">
<input id="empid" Name="empid" type="hidden"  value="<?php echo $emp_id;?>">
<input type="hidden" id="uid" Name="uid" value="<?php echo $uID;?>">
<table >
<tbody>
<tr><td valign=top>Full Name :</td>
 <td><input type="text" class="validate[required]" name="name" id="name" value="<?php echo $result[0]['Name']?>" style="width:202px;"/></td>
</tr>
<tr><td colspan="2" height="10px"></td></tr>
<tr><td valign=top>Full Address:</td>
 <td><textarea class="validate[required]" name="address" rows="2" cols="50"><?php echo $result[0]['address']?></textarea></td>
</tr>

<tr><td colspan="2" height="10px"></td></tr>
<tr>  
<td>Email Id:</td>
<td><input type="text"  name="Email" id="Email" value="<?php echo $result[0]['Email']?>" style="width:202px;"/></td>
</tr>	
<tr><td colspan="2" height="10px"></td></tr>
<tr>
<td>EMP ID:</td>
<td>
	<input type="text" class="validate[required]" name="Login" id="Login" value="<?php echo $result[0]['Login']?>" style="width:202px;"/>
</td>
</tr>
<tr><td colspan="2" height="10px"></td></tr>
<tr>  
<td>Password:</td>
<td><input type="password" value="Xdbs@123" name="Password" id="Password" style="width:202px;"/></td>
</tr>
<tr><td colspan="2" height="10px"></td></tr>
<tr valign="top">
				<td  width="170">Department</td>
			    <td>
				<select name="dept" id="dept" style="width:202px;" class="validate[required]">
						<option value=""> -- please choose -- </option>
						<?
						$query15 = "select * from dept_master";
						$res1 = mysql_query($query15);
						while($d1=mysql_fetch_array($res1))
						{
						?>
						<option <?if($d1['dept_id']==$result[0]['department']){echo "selected";}?> value="<?=$d1['dept_id']?>"><?=$d1['department_name']?></option>
						<?}?>
				</select>
				</td>
			</tr>
			<tr>
				<td colspan="2" height="10px"></td>
			</tr>
			<tr valign="top">
				<td  width="170">Reporting Manager</td>
				<td>
				<select name="reportmgr" id="reportmgr" style="width:202px; class="validate[required]"">
						<option value=""> -- please choose -- </option>
						<?
						$query16 = "select * from users where id > 1";
						$res2 = mysql_query($query16);
						while($d2=mysql_fetch_array($res2))
						{
						?>
						<option value="<?=$d2['id']?>" <?if($d2['id']==$result[0]['reporting_mgr']){echo "selected";}?>><?=$d2['Name']?></option>
						<?}?>
				</select>
				</td>
			</tr>
         	<tr>
				<td colspan="2" height="10px"></td>
			</tr>
			<tr valign="top">
				<td  width="170">Date Of Joining</td>
				<td><input class="validate[required]" readonly type="text" name="from" id="from" value="<?php echo $result[0]['dt_ofjoin']?>" style="width:202px;">
		        </td>
			</tr>
			<tr><td colspan="2" height="10px"></td></tr>
         	<tr>	
			  	<td width="170">Date Of Leaving</td>				
		        <td><input  readonly type="text" name="to" id="to" value="<?php echo $result[0]['dt_ofleave']?> "style="width:202px;">
				</td>
			</tr>
			<tr>
				<td colspan="2" height="10px"></td>
			</tr>
			<tr valign="top">
				<td width="170">Tenure</td>
				<td><input id="tenure"  Name="tenure" type="text" value="<?php echo $result[0]['tenure']?>" class="FormInput" style="width:202px;" value=""></td>
			</tr>
			<tr>
				<td colspan="2" height="10px"></td>
			</tr>
			<tr valign="top">
			<td width="170">Shift InTime</td>
			<td>
			<select name="sitm" id="sitm" style="width:202px;">
			<option value=''>-Select-</option>
			<option value='1' <?if($result[0]['shift']==1){echo "selected";}?>>18:00</option>
			<option value='2' <?if($result[0]['shift']==1){echo "selected";}?>>5:00</option>
			</select>
			</td>

			</tr>
			<tr>
				<td colspan="2" height="10px"></td>
			</tr>
			<tr valign="top">
				<td width="170">Billing Status</td>
				<td>
				<select name="billsts" id="billsts" style="width:202px;" class="validate[required]">
				<option value=''>-Select-</option>
				<option value='1' <?if($result[0]['billing_status']==1){echo "selected";}?> selected>Billable</option>
				<option value='2' <?if($result[0]['billing_status']==2){echo "selected";}?>>Non Billable</option>
				</select>
				</td>
			</tr>
			<tr>
				<td colspan="2" height="10px"></td>
			</tr>
			<tr valign="top">
				<td width="170">Employee Status</td>
				<td>
				<select name="empsts" id="empsts" class="validate[required]" style="width:202px;">
				<option value=''>-Select-</option>
				<option value='0' <?if($result[0]['emp_status']==1){echo "selected";}?> selected>Active</option>
				<option value='1' <?if($result[0]['emp_status']==2){echo "selected";}?>>Not Active</option>
				</select>
				</td>
			</tr>
			<tr>
				<td colspan="2" height="10px"></td>
			</tr>
				<tr valign="top">
				<td width="170">Cab Facility</td>
				<td>
				<select name="cab" id="cab" class="validate[required]" style="width:202px;">
				<option value=''>-Select-</option>
				<option value='Yes' <?if($result[0]['shift_in']==1){echo "selected";}?>>Yes</option>
				<option value='NO' <?if($result[0]['shift_in']==1){echo "selected";}?>>NO</option>
				</select>
				</td>
			</tr>
			
			<tr>
				<td colspan="2" height="10px"></td>
			</tr>
			
<tr><td></td>
<td><input type="submit" name="Submit" id="Submit" value="Submit"></td>
</tr>
</table>
</form>


</div>
</div>
</div>
</body>
</html>